package com.zc.web.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zc.common.utils.DateUtils;
import com.zc.web.domain.DailyQuote;
import com.zc.web.mapper.DailyQuoteMapper;

import com.zc.web.service.IDailyQuoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.Arrays;

/**
 * 每日一句Service业务层处理
 *
 * @author zc
 * @date 2025-10-16
 */
@Service
public class DailyQuoteServiceImpl extends ServiceImpl<DailyQuoteMapper, DailyQuote> implements IDailyQuoteService
{
    @Autowired
    private DailyQuoteMapper dailyQuoteMapper;

    /**
     * 查询每日一句
     *
     * @param id 每日一句主键
     * @return 每日一句
     */
    @Override
    public DailyQuote selectDailyQuoteById(Long id)
    {
                return getById(id);
    }

    /**
     * 查询每日一句列表
     *
     * @param dailyQuote 每日一句
     * @return 每日一句
     */
    @Override
    public List<DailyQuote> selectDailyQuoteList(DailyQuote dailyQuote)
    {
        return dailyQuoteMapper.selectDailyQuoteList(dailyQuote);
    }

    /**
     * 新增每日一句
     *
     * @param dailyQuote 每日一句
     * @return 结果
     */
    @Override
    public int insertDailyQuote(DailyQuote dailyQuote)
    {

                dailyQuote.setCreateTime(DateUtils.getNowDate());
   return save(dailyQuote) == true? 1 : 0;
    }

    /**
     * 修改每日一句
     *
     * @param dailyQuote 每日一句
     * @return 结果
     */
    @Override
    public int updateDailyQuote(DailyQuote dailyQuote)
    {

                dailyQuote.setUpdateTime(DateUtils.getNowDate());
                return updateById(dailyQuote) == true ? 1 : 0;
    }

    /**
     * 批量删除每日一句
     *
     * @param ids 需要删除的每日一句主键
     * @return 结果
     */
    @Override
    public int deleteDailyQuoteByIds(Long[] ids)
    {
                return removeByIds(Arrays.asList(ids)) == true ? 1 : 0;
    }

    /**
     * 删除每日一句信息
     *
     * @param id 每日一句主键
     * @return 结果
     */
    @Override
    public int deleteDailyQuoteById(Long id)
    {
                return removeById(id) == true ? 1 : 0;
    }
}